<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core">

<ui:composition template="/WEB-INF/templates/BasicTemplate.xhtml">

	<ui:define name="content">
	<c:set target="#{flash}" property="keepMessages" value="false" />
	    <h:form id="register">
	    	<h:panelGrid columns="3">
	    		
				<h:outputLabel for="name" value="Imie"/>
				<h:inputText id="name" value="#{registerUserBean.name}" required="true" requiredMessage="Please enter name">
					<f:ajax event="blur" render="nameMessage"/>
				</h:inputText>
				<h:message id="nameMessage" for="name" style="background-color: red;"></h:message>
				
				
				<h:outputLabel value="Nazwisko" for="surname"/>
				<h:inputText id="surname" value="#{registerUserBean.surname}" required="true" requiredMessage="Please enter surname">
					<f:ajax event="blur" render="surnameMessage"/>
				</h:inputText>
				<h:message id="surnameMessage" for="surname"/>
				
				<h:outputLabel value="Login" for="login"/>
				<h:inputText id="login" value="#{registerUserBean.login}" required="true" requiredMessage="Please enter login">
					<f:ajax event="blur" render="loginMessage"/>
				</h:inputText>
				<h:message id="loginMessage" for="login"/>
				
				<h:outputLabel value="Hasło" for="password"/>
				<h:inputSecret id="password" value="#{registerUserBean.password}" required="true" redisplay="true" requiredMessage="Please enter password">
					<f:ajax event="blur" render="passwordMessage"/>
				</h:inputSecret>
				<h:message id="passwordMessage" for="password"/>
				
				
				<h:outputLabel value="Email" for="email"/>
				<h:inputText id="email" value="#{registerUserBean.email}" required="true" requiredMessage="Invalid email">
					<f:ajax event="blur" render="emailMessage"/>
				</h:inputText>
				<h:message id="emailMessage" for="email" />
				<br/>
				<h:commandButton value="Zarejestruj" action="#{registerUserBean.register}">
						<f:ajax execute="@form" render="@form"/>
				</h:commandButton>
				

				<h:messages globalOnly="true" layout="table"/>
				
			</h:panelGrid>
	    </h:form>
	</ui:define>

</ui:composition>
</html>